<?php
/**
 * regap define error code and message file
 *
 * @author	rabbits <rbtsgm at gmail.com>
 * @package	Regap1
 *
 */

$i = 0; 
$g_arrStringError = array();

$i++; define('E_REGAP_ID_NON_EXISTS',$i); $g_arrStringError[$i] = "ID doesn't exist. ";
$i++; define('E_REGAP_PDO_PREPARE',$i); $g_arrStringError[$i] = "The error occurred by the prepared processing of PDO(%s:%s:%s).";
$i++; define('E_REGAP_PDO_QUERY',$i); $g_arrStringError[$i] = "The error occurred by the query execution of PDO(%s:%s:%s).";
$i++; define('E_REGAP_GET_CONTENTS',$i); $g_arrStringError[$i] = "The contents data was not able to be acquired. ";
//$i++; define('E_REGAP_EDIT_SELECT_FROM_TEMPLATE_TBL,$i); $g_arrStringError[$i] = "Data from the template table was not able to be acquired in the edit action.";
$i++; define('E_REGAP_GET_EDIT_TEMPLATE_PATH',$i); $g_arrStringError[$i] = "The edit template passing of the edit template table was not able to be acquired.";
$i++; define('E_REGAP_GET_TOKEN',$i); $g_arrStringError[$i] = "The cookie doesn't exist.";
$i++; define('E_REGAP_JS_OUTPUT',$i); $g_arrStringError[$i] = 'It failed in the output of the JavaScript file(%s).';
$i++; define('E_REGAP_PAGE_EDIT_ACTION',$i); $g_arrStringError[$i] = "The specified action is NULL or it doesn't exist(%s).";
$i++; define('E_REGAP_PAGE_EDIT_TEMPLATE_PATH',$i); $g_arrStringError[$i] = "The template doesn't exist(%s).";
$i++; define('E_REGAP_PDO_EXECUTE', $i); $g_arrStringError[$i] = "The error occurred by the prepared execution of PDO(%s:%s:%s).";
$i++; define('E_REGAP_PAGE_EDIT_ID',$i); $g_arrStringError[$i] = "ID doesn't exist.";
$i++; define('E_REGAP_PAGE_EDIT_RELEASE_OB_START',$i); $g_arrStringError[$i] = "Buffering cannot be begun.";
$i++; define('E_REGAP_PAGE_EDIT_RELEASE_FILE_WRITE',$i); $g_arrStringError[$i] = "It failed in writing the file(%s).";
$i++; define('E_REGAP_PAGE_EDIT_RELEASE_FILE_CLOSE',$i); $g_arrStringError[$i] = "It failed in the close of the file(%s).";
$i++; define('E_REGAP_PAGE_RELEASE_OB_START',$i); $g_arrStringError[$i] = "Buffering cannot be begun.";
$i++; define('E_REGAP_PAGE_RELEASE_FILE_OPEN',$i); $g_arrStringError[$i] = "The file cannot be opened(%s).";
$i++; define('E_REGAP_PAGE_RELEASE_FILE_WRITE',$i); $g_arrStringError[$i] = "It failed in writing the file(%s).";
$i++; define('E_REGAP_PAGE_RELEASE_FILE_CLOSE',$i); $g_arrStringError[$i] = "It failed in the close of the file(%s).";

function regap_get_error_string($code, $arr = null)
{
	if ($arr) {
		$message = vsprintf($GLOBALS['g_arrStringError'][$code], $arr);
	}
	else {
		$message = $GLOBALS['g_arrStringError'][$code];
	}

	$str = "[Regap:" . $code . "] " . $message;
	return $str;
}

?>
